package LanQiao;

import java.util.Scanner;
import java.util.Stack;

public class Demo5 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        int count = 0;
        while (num != 0) {
            Stack<Integer> stack = new Stack<>();
            int num1 = num;
            while (num1 != 0) {
                stack.push(num1 % 10);
                num1 /= 10;
            }
            while (!stack.isEmpty()) {
                int n = stack.pop();
                if (n == 0)  {
                    num1 *= 10;
                } else {
                    num1 = num1 * 10 + (n - 1);
                }
            }
            num = num1;
            count++;
        }
        System.out.println(count);
    }
}
